package juc.day02;

/**
 * @author wang hao
 * @date 2023-03-18 13:11
 */
public class Demo01 {
    /*
        并发编程的三大 特性： 可见性 有序性 原子性
           读取缓存 是 每次读取一个 缓存行，  cache line   大小是64个字节
     */
//    private static boolean running = true;
    private static volatile boolean running = true;

    private static void m(){
        System.out.println("m start");
        while (running){

        }
        System.out.println("m stop");
    }

    public static void main(String[] args) throws InterruptedException {
        new Thread(Demo01::m, "t1").start();
        Thread.sleep(1000);
        running =false;
    }
}
